﻿using H2.NET.Common;
using H2.NET.Web.Pages.SMD.Service;
using H2.NET.Web.Workflow.DwzCode;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;

namespace H2.NET.Web.Pages.SMD
{
    public partial class StoreView : BasePage
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            var authid = AksRequest.GetQueryString("authid");
            var store = StoreService.GetSmdStoreByAuthID(authid);
            if (store.DealerID != null)
            {
                var dealer = DealerService.GetById(store.DealerID.Value);
                uc_dealer1.dealer = dealer;
            }
            uc_dealer1.IsCanEditAuthID = false;

            l_authid_new.Text = store.AuthID;
            l_storeStatus.Text = store.StoreStatus;
            l_store_type.Text = store.StoreType;
            l_channel.Text = store.Channel;
            l_region.Text = store.Region;
            l_province.Text = store.Province;
            l_cityName.Text = store.CityName;
            l_MallShortName.Text = store.MallShortName;
            l_MallName.Text = store.MallName;
            l_HouseNumber.Text = store.HouseNumber;
            l_store_name.Text = store.StoreName;
            l_ShopSeq.Text = store.ShopSeq;
            l_ContractPerson.Text = store.ContactPerson;
            l_Telephone.Text = store.PhoneNumber;
            l_address.Text = store.StoreAddress;
            l_size.Text = store.StoreSize.ToString();
            l_FirstStartDate.Text = store.FirstStartDate == null ? "" : store.FirstStartDate.Value.ToString("yyyy-MM-dd");
            l_IsColourService.Text = store.IsColourService == null ? "否" : (store.IsColourService.Value ? "是" : "否");
            l_IsTintingService.Text = store.IsTintingService == null ? "否" : (store.IsTintingService.Value ? "是" : "否");
            l_ShowInWebsite.Text = store.ShowInWebsite == null ? "否" : (store.ShowInWebsite.Value ? "是" : "否");
            if (store.IsUpgraded == true)
            {
                l_IsUpgraded.Text = "是";
                l_BeforeUpgradedType.Text = store.BeforeUpgradedType;
            }
            else
            {
                l_IsUpgraded.Text = "否";
            }
            if (store.IsDowngraded == true)
            {
                l_IsDowngraded.Text = "是";
                l_BeforeDowngradedType.Text = store.BeforeDowngradedType;
            }
            else
            {
                l_IsDowngraded.Text = "否";
            }
            if (store.IsRenew == true)
            {
                l_IsRenew.Text = "是";
                l_BeforeRenewType.Text = store.BeforeRenewType;
            }
            else
            {
                l_IsRenew.Text = "否";
            }

            l_StoreApprovedDate.Text = store.StoreApprovedDate == null ? "" : store.StoreApprovedDate.Value.ToString("yyyy-MM-dd");
            l_EapproveSN.Text = store.EapproveSN;

            #region Add By Tony 20160525
            l_bmccode.Text = store.BMCCode == null ? "" : store.BMCCode;
            l_bmcname.Text = store.BMCName == null ? "" : store.BMCName;
            l_accountowner.Text = store.AccountOwner == null ? "" : store.AccountOwner;
            l_wechatid.Text = store.WechatId == null ? "" : store.WechatId;
            l_District.Text = store.District == null ? "" : store.District;
            #endregion
        }
    }
}